{% extends base_template %}
{% load i18n l10n %}
{% load url from future %}
{% load xadmin_tags %}

{% block breadcrumbs %}
<ul class="breadcrumb">
<li><a href="{% url 'xadmin:index' %}">{% trans 'Home' %}</a></li>
<li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a></li>
<li>{% trans "Export" %} App</li>
</ul>
{% endblock %}
{% block nav_title %}
    {{title}}
{% endblock %}
{% block content %}
    <table class="table table-bordered table-hover table-condensed">
        <thead>
            <tr>
                {% for foo in app_th %}
                    <th>{{ foo }}</th>
                {% endfor %}
            </tr>
        </thead>
        <tbody>
            {% for foo in app_td %}
                <tr>
                {% for i in foo %}
                    <td>{{ i|safe }}</td>
                {% endfor %}
                </tr>
            {% endfor %}
        </tbody>
    </table>

    <div class="form-actions well well-sm">
        <a class="btn btn-danger btn-lg"
           data-toggle="modal"
           data-target="#export-app-modal"
            >
            {% trans "Yes, I'm sure" %}
        </a>
        <a class="btn btn-default pull-right"
           onclick="javascript:history.back();" >
            {% trans 'Cancel' %}
        </a>
    </div>

    <div id="export-app-modal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <form method="post" action="">{% csrf_token %}
                <div class="modal-header">
{#                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>#}
                    <h4 class="modal-title">{% trans "Export" %} {{et.name}}</h4>
                </div>
                <div class="modal-body">
                    {% for obj in queryset %}
                    <input type="hidden" name="{{ action_checkbox_name }}" value="{{ obj.pk|unlocalize }}" />
                    {% endfor %}
                    <input type="hidden" name="action" value="Subject_Action" />
                    <input type="hidden" name="finish" value="yes" />
                    {% view_block 'form_fields' %}
                    {% for type in subjects %}
                        {% if type.checked %}
                            <label class="checkbox">
                                <input type="checkbox" name="{{ type.id }}" checked="checked" value="on"> {{ type.name }}
                            </label>
                        {% else %}
                            <label class="checkbox">
                                <input type="checkbox" name="{{ type.id }}" value="on"> {{ type.name }}
                            </label>
                        {% endif %}
                    {% endfor %}

                </div>

                    <div class="modal-footer">
                            <button id="myButton" class="btn btn-success btn-lg ladda-button center-block" data-loading-text="打包中...请耐心等待..."><i class="fa fa-apple"></i>  开始打包
                                <span class="ladda-label">
                            </span>
                            </button>
                    </div>

                    <script>
                        $('#myButton').on('click', function () {
                            var $btn = $(this).button('loading')
                        })
                    </script>

                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dalog -->
    </div><!-- /.modal -->

{% endblock %}


